VERSION 5.00
Object = "{8DDE6232-1BB0-11D0-81C3-0080C7A2EF7D}#2.1#0"; "Flp32x20.ocx"
Object = "{CDF3B183-D408-11CE-AE2C-0080C786E37D}#2.1#0"; "Edt32x20.ocx"
Begin VB.Form frmSOLDE 
   Caption         =   "SAISIE des REGLEMENTS"
   ClientHeight    =   6540
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   12210
   LinkTopic       =   "Form1"
   ScaleHeight     =   6540
   ScaleWidth      =   12210
   StartUpPosition =   3  'Windows Default
   Begin LpLib.fpList LD_FACTURES 
      Height          =   4788
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   12012
      _Version        =   131073
      _ExtentX        =   21188
      _ExtentY        =   8446
      _StockProps     =   68
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Text            =   ""
      Columns         =   0
      Sorted          =   0
      SelDrawFocusRect=   -1  'True
      ColumnSeparatorChar=   9
      ColumnSearch    =   -1
      ColumnWidthScale=   2
      RowHeight       =   255
      MultiSelect     =   0
      WrapList        =   0   'False
      WrapWidth       =   0
      SelMax          =   -1
      AutoSearch      =   1
      SearchMethod    =   0
      VirtualMode     =   0   'False
      VRowCount       =   0
      DataSync        =   3
      ThreeDInsideStyle=   1
      ThreeDInsideHighlightColor=   -2147483633
      ThreeDInsideShadowColor=   -2147483642
      ThreeDInsideWidth=   2
      ThreeDOutsideStyle=   2
      ThreeDOutsideHighlightColor=   16777215
      ThreeDOutsideShadowColor=   -2147483632
      ThreeDOutsideWidth=   2
      ThreeDFrameWidth=   0
      BorderStyle     =   1
      BorderColor     =   -2147483647
      BorderWidth     =   1
      ThreeDOnFocusInvert=   0   'False
      ThreeDFrameColor=   -2147483633
      Appearance      =   0
      BorderDropShadow=   0
      BorderDropShadowColor=   -2147483632
      BorderDropShadowWidth=   1
      ScrollHScale    =   2
      ScrollHInc      =   0
      ColsFrozen      =   0
      ScrollBarV      =   1
      NoIntegralHeight=   -1  'True
      HighestPrecedence=   0
      AllowColResize  =   0
      AllowColDragDrop=   0
      ReadOnly        =   0   'False
      VScrollSpecial  =   0   'False
      VScrollSpecialType=   0
      EnableKeyEvents =   -1  'True
      EnableTopChangeEvent=   -1  'True
      DataAutoHeadings=   -1  'True
      DataAutoSizeCols=   2
      SearchIgnoreCase=   -1  'True
      ColDesigner     =   "SOLDE.frx":0000
      ScrollBarH      =   1
      DataFieldList   =   ""
      ColumnEdit      =   0
      ColumnBound     =   0
      Style           =   0
      MaxDrop         =   0
      ListWidth       =   0
      EditHeight      =   0
      GrayAreaColor   =   0
      ListLeftOffset  =   0
      ComboGap        =   0
      MaxEditLen      =   0
      VirtualPageSize =   0
      VirtualPagesAhead=   0
      ExtendCol       =   0
      ColumnLevels    =   1
      ListGrayAreaColor=   -2147483637
      GroupHeaderHeight=   -1
      GroupHeaderShow =   0   'False
      AllowGrpResize  =   0
      AllowGrpDragDrop=   0
      MergeAdjustView =   0   'False
      ColumnHeaderShow=   0   'False
      ColumnHeaderHeight=   -1
      GrpsFrozen      =   0
      BorderGrayAreaColor=   -2147483637
      ExtendRow       =   0
   End
   Begin VB.Frame Frame1 
      Height          =   1455
      Left            =   120
      TabIndex        =   1
      Top             =   4920
      Width           =   12012
      Begin EditLib.fpCurrency TE_Total 
         Height          =   372
         Index           =   2
         Left            =   10680
         TabIndex        =   4
         Top             =   240
         Width           =   1212
         _Version        =   131073
         _ExtentX        =   2143
         _ExtentY        =   661
         _StockProps     =   68
         BackColor       =   12640511
         ForeColor       =   -2147483640
         ThreeDInsideStyle=   1
         ThreeDInsideHighlightColor=   -2147483633
         ThreeDInsideShadowColor=   -2147483642
         ThreeDInsideWidth=   1
         ThreeDOutsideStyle=   1
         ThreeDOutsideHighlightColor=   16777215
         ThreeDOutsideShadowColor=   -2147483632
         ThreeDOutsideWidth=   1
         ThreeDFrameWidth=   0
         BorderStyle     =   0
         BorderColor     =   -2147483642
         BorderWidth     =   1
         ButtonDisable   =   0   'False
         ButtonHide      =   0   'False
         ButtonIncrement =   1
         ButtonMin       =   0
         ButtonMax       =   100
         ButtonStyle     =   0
         ButtonWidth     =   0
         ButtonWrap      =   -1  'True
         ButtonDefaultAction=   -1  'True
         ThreeDText      =   0
         ThreeDTextHighlightColor=   -2147483633
         ThreeDTextShadowColor=   -2147483632
         ThreeDTextOffset=   1
         AlignTextH      =   2
         AlignTextV      =   0
         AllowNull       =   0   'False
         NoSpecialKeys   =   0
         AutoAdvance     =   0   'False
         AutoBeep        =   0   'False
         CaretInsert     =   0
         CaretOverWrite  =   3
         UserEntry       =   0
         HideSelection   =   -1  'True
         InvalidColor    =   -2147483637
         InvalidOption   =   0
         MarginLeft      =   3
         MarginTop       =   3
         MarginRight     =   3
         MarginBottom    =   3
         NullColor       =   -2147483637
         OnFocusAlignH   =   0
         OnFocusAlignV   =   0
         OnFocusNoSelect =   0   'False
         OnFocusPosition =   0
         ControlType     =   1
         Text            =   "0.00  "
         CurrencyDecimalPlaces=   -1
         CurrencyNegFormat=   0
         CurrencyPlacement=   0
         CurrencySymbol  =   " "
         DecimalPoint    =   ""
         FixedPoint      =   -1  'True
         LeadZero        =   0
         MaxValue        =   "9000000000"
         MinValue        =   "-9000000000"
         NegToggle       =   0   'False
         Separator       =   ""
         UseSeparator    =   -1  'True
         IncInt          =   1
         IncDec          =   1
         BorderGrayAreaColor=   -2147483637
         ThreeDOnFocusInvert=   0   'False
         ThreeDFrameColor=   -2147483633
         Appearance      =   2
         BorderDropShadow=   0
         BorderDropShadowColor=   -2147483632
         BorderDropShadowWidth=   3
         MouseIcon       =   "SOLDE.frx":022A
      End
      Begin EditLib.fpCurrency TE_Total 
         Height          =   372
         Index           =   1
         Left            =   9360
         TabIndex        =   3
         Top             =   240
         Width           =   1212
         _Version        =   131073
         _ExtentX        =   2143
         _ExtentY        =   661
         _StockProps     =   68
         BackColor       =   12648384
         ForeColor       =   -2147483640
         ThreeDInsideStyle=   1
         ThreeDInsideHighlightColor=   -2147483633
         ThreeDInsideShadowColor=   -2147483642
         ThreeDInsideWidth=   1
         ThreeDOutsideStyle=   1
         ThreeDOutsideHighlightColor=   16777215
         ThreeDOutsideShadowColor=   -2147483632
         ThreeDOutsideWidth=   1
         ThreeDFrameWidth=   0
         BorderStyle     =   0
         BorderColor     =   -2147483642
         BorderWidth     =   1
         ButtonDisable   =   0   'False
         ButtonHide      =   0   'False
         ButtonIncrement =   1
         ButtonMin       =   0
         ButtonMax       =   100
         ButtonStyle     =   0
         ButtonWidth     =   0
         ButtonWrap      =   -1  'True
         ButtonDefaultAction=   -1  'True
         ThreeDText      =   0
         ThreeDTextHighlightColor=   -2147483633
         ThreeDTextShadowColor=   -2147483632
         ThreeDTextOffset=   1
         AlignTextH      =   2
         AlignTextV      =   0
         AllowNull       =   0   'False
         NoSpecialKeys   =   0
         AutoAdvance     =   0   'False
         AutoBeep        =   0   'False
         CaretInsert     =   0
         CaretOverWrite  =   3
         UserEntry       =   0
         HideSelection   =   -1  'True
         InvalidColor    =   -2147483637
         InvalidOption   =   0
         MarginLeft      =   3
         MarginTop       =   3
         MarginRight     =   3
         MarginBottom    =   3
         NullColor       =   -2147483637
         OnFocusAlignH   =   0
         OnFocusAlignV   =   0
         OnFocusNoSelect =   0   'False
         OnFocusPosition =   0
         ControlType     =   1
         Text            =   "0.00  "
         CurrencyDecimalPlaces=   -1
         CurrencyNegFormat=   0
         CurrencyPlacement=   0
         CurrencySymbol  =   " "
         DecimalPoint    =   ""
         FixedPoint      =   -1  'True
         LeadZero        =   0
         MaxValue        =   "9000000000"
         MinValue        =   "-9000000000"
         NegToggle       =   0   'False
         Separator       =   ""
         UseSeparator    =   -1  'True
         IncInt          =   1
         IncDec          =   1
         BorderGrayAreaColor=   -2147483637
         ThreeDOnFocusInvert=   0   'False
         ThreeDFrameColor=   -2147483633
         Appearance      =   2
         BorderDropShadow=   0
         BorderDropShadowColor=   -2147483632
         BorderDropShadowWidth=   3
         MouseIcon       =   "SOLDE.frx":0246
      End
      Begin EditLib.fpCurrency TE_Total 
         Height          =   372
         Index           =   0
         Left            =   8040
         TabIndex        =   2
         Top             =   240
         Width           =   1212
         _Version        =   131073
         _ExtentX        =   2143
         _ExtentY        =   661
         _StockProps     =   68
         BackColor       =   12648384
         ForeColor       =   -2147483640
         ThreeDInsideStyle=   1
         ThreeDInsideHighlightColor=   -2147483633
         ThreeDInsideShadowColor=   -2147483642
         ThreeDInsideWidth=   1
         ThreeDOutsideStyle=   1
         ThreeDOutsideHighlightColor=   16777215
         ThreeDOutsideShadowColor=   -2147483632
         ThreeDOutsideWidth=   1
         ThreeDFrameWidth=   0
         BorderStyle     =   0
         BorderColor     =   -2147483642
         BorderWidth     =   1
         ButtonDisable   =   0   'False
         ButtonHide      =   0   'False
         ButtonIncrement =   1
         ButtonMin       =   0
         ButtonMax       =   100
         ButtonStyle     =   0
         ButtonWidth     =   0
         ButtonWrap      =   -1  'True
         ButtonDefaultAction=   -1  'True
         ThreeDText      =   0
         ThreeDTextHighlightColor=   -2147483633
         ThreeDTextShadowColor=   -2147483632
         ThreeDTextOffset=   1
         AlignTextH      =   2
         AlignTextV      =   0
         AllowNull       =   0   'False
         NoSpecialKeys   =   0
         AutoAdvance     =   0   'False
         AutoBeep        =   0   'False
         CaretInsert     =   0
         CaretOverWrite  =   3
         UserEntry       =   0
         HideSelection   =   -1  'True
         InvalidColor    =   -2147483637
         InvalidOption   =   0
         MarginLeft      =   3
         MarginTop       =   3
         MarginRight     =   3
         MarginBottom    =   3
         NullColor       =   -2147483637
         OnFocusAlignH   =   0
         OnFocusAlignV   =   0
         OnFocusNoSelect =   0   'False
         OnFocusPosition =   0
         ControlType     =   1
         Text            =   "0.00  "
         CurrencyDecimalPlaces=   -1
         CurrencyNegFormat=   0
         CurrencyPlacement=   0
         CurrencySymbol  =   " "
         DecimalPoint    =   ""
         FixedPoint      =   -1  'True
         LeadZero        =   0
         MaxValue        =   "9000000000"
         MinValue        =   "-9000000000"
         NegToggle       =   0   'False
         Separator       =   ""
         UseSeparator    =   -1  'True
         IncInt          =   1
         IncDec          =   1
         BorderGrayAreaColor=   -2147483637
         ThreeDOnFocusInvert=   0   'False
         ThreeDFrameColor=   -2147483633
         Appearance      =   2
         BorderDropShadow=   0
         BorderDropShadowColor=   -2147483632
         BorderDropShadowWidth=   3
         MouseIcon       =   "SOLDE.frx":0262
      End
      Begin VB.CommandButton BO_Imprimer 
         Height          =   570
         Left            =   10680
         Picture         =   "SOLDE.frx":027E
         Style           =   1  'Graphical
         TabIndex        =   6
         ToolTipText     =   "Edition des Journaux"
         Top             =   720
         Width           =   1200
      End
      Begin VB.CommandButton BO_REMISE 
         Height          =   570
         Left            =   5520
         Picture         =   "SOLDE.frx":2A20
         Style           =   1  'Graphical
         TabIndex        =   5
         ToolTipText     =   "Bordereau de Remise Chèques"
         Top             =   720
         Width           =   1080
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         Caption         =   "Sélectionner une ligne puis tapez Entrée ou Double-cliquez"
         Height          =   255
         Index           =   1
         Left            =   240
         TabIndex        =   7
         Top             =   240
         Width           =   6375
      End
   End
End
Attribute VB_Name = "frmSOLDE"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Compare Text

Private rs As ADODB.Recordset
Private szSql As String

Dim x_AfficheMontant As Integer

Private Sub BO_Imprimer_Click()

   gRubrique = "JOURN"
   frmEDITION.Show vbModal

End Sub

Private Sub BO_REMISE_Click()

   gRubrique = "REMISE"
   frmREMISE.Show vbModal

End Sub

Private Sub Form_Activate()
   LD_FACTURES.SetFocus

End Sub

Private Sub Form_Load()
   
   Me.BackColor = gBackColor
   fDessinerParClient
   gNoDossier = 0
   
End Sub


Private Sub fDessinerParClient()

    Dim szItem As String
    
    'Vider la LD_FACTURES
    LD_FACTURES.Clear
    
    ' initialiser les entêtes de colonnes
    LD_FACTURES.HeaderShow = True
    LD_FACTURES.Columns = 7
    LD_FACTURES.ScrollBarV = 1
    LD_FACTURES.DataAutoSizeCols = 0 'Off
                                      
    LD_FACTURES.Col = 0
    LD_FACTURES.ColWidth = 33
    LD_FACTURES.ColAlignH = 0
    LD_FACTURES.ColHeaderText = "Client"

    LD_FACTURES.Col = 1
    LD_FACTURES.ColWidth = 12
    LD_FACTURES.ColAlignH = 0
    LD_FACTURES.ColHeaderText = "Date"

    LD_FACTURES.Col = 2
    LD_FACTURES.ColWidth = 8
    LD_FACTURES.ColAlignH = 0
    LD_FACTURES.ColHeaderText = "Numéro"
    
    LD_FACTURES.Col = 3
    LD_FACTURES.ColWidth = 22
    LD_FACTURES.ColAlignH = 0
    LD_FACTURES.ColHeaderText = "Chantier"

   LD_FACTURES.Col = 4
   LD_FACTURES.ColWidth = 12
   LD_FACTURES.ColAlignH = 0
   LD_FACTURES.ColHeaderText = "MT TTC"
   LD_FACTURES.ListApplyTo = LC_LISTAPPLYTO_SINGLE_ITEM
   LD_FACTURES.AlignH = LC_ALIGNH_RIGHT
   
   LD_FACTURES.Col = 5
   LD_FACTURES.ColWidth = 12
   LD_FACTURES.ColAlignH = 0
   LD_FACTURES.ColHeaderText = "Réglée"
   LD_FACTURES.ListApplyTo = LC_LISTAPPLYTO_SINGLE_ITEM
   LD_FACTURES.AlignH = LC_ALIGNH_RIGHT
        
   LD_FACTURES.Col = 6
   LD_FACTURES.ColWidth = 12
   LD_FACTURES.ColAlignH = 0
   LD_FACTURES.ColHeaderText = "Solde"
   LD_FACTURES.ListApplyTo = LC_LISTAPPLYTO_SINGLE_ITEM
   LD_FACTURES.AlignH = LC_ALIGNH_RIGHT
        
   'Lire les factures non soldées
   szSql = "CALL spGET_FACTURE_NonReglees('" & gSociete & "',0,0);"
   Call GetRecordset(ctDSN_DEVFAC, szSql, rs)
    
   TE_Total(0) = 0
   TE_Total(1) = 0
                        
   Do Until rs.EOF
       szItem = rs!nomcli & Chr$(9) & rs!Date & Chr$(9) & _
                Format(rs!NO_ID, "000000") & Chr$(9) & rs!c_nom & Chr$(9) & _
                Format(rs!TotalTTC, "#0.00") & Chr$(9) & _
                Format(rs!MtRegl, "#0.00") & Chr$(9) & _
                Format(rs!TotalTTC - rs!MtRegl, "#0.00") & Chr$(9)
       
       LD_FACTURES.AddItem szItem
      TE_Total(0) = TE_Total(0) + rs!TotalTTC
      TE_Total(1) = TE_Total(1) + rs!MtRegl
       rs.MoveNext
   Loop
   TE_Total(2) = TE_Total(0) - TE_Total(1)
   LD_FACTURES.ListIndex = 0
   rs.Close

End Sub

Private Sub LD_FACTURES_DblClick()
   
   LD_FACTURES.Row = LD_FACTURES.ListIndex
   LD_FACTURES.Col = 2   ' retourne le Noordre
   gNoDossier = LD_FACTURES.ColList

   If gNoDossier = 0 Then
      MsgBox "Vous devez d'abord sélectionner une Facture" & vbCrLf & _
      "pour saisir un réglement", vbExclamation
      Exit Sub
   End If
   frmREGLEMENT.Show vbModal
   fDessinerParClient

End Sub


Private Sub LD_FACTURES_KeyDown(KeyCode As Integer, Shift As Integer)
   
   If KeyCode = vbKeyReturn Then
      LD_FACTURES_DblClick
   End If

End Sub

Private Sub fTraiterKeydown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then
      SendKeys "{TAB}"
End If

End Sub

